<?php

class xt_searchFieldHandler {

    function startElement(phpinchains_parser_psp_PSPParser $sender, $attrs, $line, $file = '') {
        //  type="chooser" name="ma_beteiligtAn_id" referencing="Rechtssubjekt"
        $attrs['type']        = (empty($attrs['type']))?"''":$attrs['type'];
        $attrs['name']        = (empty($attrs['name']))?"''":$attrs['name'];
        $attrs['description'] = (empty($attrs['description']))?"''":$attrs['description'];
        $attrs['referencing'] = (empty($attrs['referencing']))?"''":$attrs['referencing'];
        $attrs['options']     = (empty($attrs['options']))?"''":$attrs['options'];
        $code = "array('type'=>{$attrs['type']}, 'name'=>{$attrs['name']}, 'description'=>{$attrs['description']}" . ($attrs['referencing'] ? ", 'referencing' => {$attrs['referencing']}" : '') . ", 'options' => array(";
        $sender->appendRequestableDataCode($code);
        $sender->appendCode($code);
    }

    function endElement(&$sender) {
        $sender->appendRequestableDataCode(")),");
        $sender->appendCode(")),");
    }

}